<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const add=(...args)=>{
      let sum=0
      for(let i=0;i<args.length;i++){
        sum+=args[i]
      }
      console.log(sum);
    }
    add(1,2,3,4)
    //与解构赋值结合使用 必须在最后一个
    const [n,...m]=[1,2,3]
    console.log(n,m);
    const {a,d,...args}={a:1,b:2,c:3,d:4}
    console.log(a,d,args);

  </script>
</body>
</html>